/********************************************************************
    copyright (c) by tnmujoy
    @created:	10/20/2011   11:16
    @filename: 	Commond
    @author:	Limiko Lau (limiko.lau@gmail.com)
    @brief:	    
*********************************************************************/

#ifndef TNMUJOY_GDUT_DESIGNPATTERN_COMMOND_H_
#define TNMUJOY_GDUT_DESIGNPATTERN_COMMOND_H_

namespace tnmujoy
{
namespace gdut
{

template<class T>
class Commond
{
public:
    virtual void execute() = 0;
    void setReceiver(T* _receiver)
    {
        receiver_ = _receiver;
    }
protected:
    T* receiver_;
private:
};

template<class T>
class Invoker
{
public:
    void setCommond(Commond<T>* _commond)
    {
        commond_ = _commond;
    }
    void runCommond()
    {
        if (commond_)
        {
            commond_->execute();
        }
    }
protected:
private:
    Commond<T>* commond_;
};

}//namespace gdut
}//namespace tnmujoy

#endif //TNMUJOY_GDUT_DESIGNPATTERN_COMMOND_H_

//
//History:
//[10/20/2011] <limiko.lau@gmail.com> created